const biFont = reactive([
  // { name: "思源宋体", value: "siyuansongti", url: "url(style/font/siyuansongti/Source_Han_Serif_SC_Light_Light.otf)" },
  {
    name: "阿里妈妈东方大楷",
    value: "alimamadongfangdakai",
    url: "url(style/font/Alimama_DongFangDaKai_Regular.woff)"
  },
  { name: "阿里妈妈数黑体", value: "alimamashuheiti", url: "url(style/font/Alimama_ShuHeiTi_Bold.woff)" },
  { name: "阿里巴巴普惠体", value: "alibabapuhuiti", url: "url(style/font/Alibaba_PuHuiTi.ttf)" },
  { name: "钉钉进步体", value: "dingdingjinbuti", url: "url(style/font/DingTalk_JinBuTi_Regular.woff)" },
  { name: "站酷高端黑", value: "zankugaoenduanhei", url: "url(style/font/zcool-gdh_Regular.ttf)" },
  { name: "站酷酷黑", value: "zankukubei", url: "url(style/font/ZCOOL_KuHei_Regular.ttf)" },
  { name: "站酷仓耳渔阳体", value: "TsangerYuYangT", url: "url(style/font/TsangerYuYangT_W03_W03.ttf)" },
  // {name:'站酷黄油体','value':'zhankuhuangyouti', 'url':'url(cdn/font/zhankuhuangyouti.ttf)'},
  { name: "得意黑斜体", value: "deyihei", url: "url(style/font/deyihei/Smiley_Sans_Oblique_斜体.woff)" },
  { name: "字魂扁桃体", value: "zihunbiantaoti", url: "url(style/font/zihunbiantaoti.ttf)" },
  { name: "斗鱼追光体", value: "douyuzhuiguangti", url: "url(style/font/douyuzhuiguangti.ttf)" },
  { name: "传奇特战体", value: "tezhanti", url: "url(style/font/tezhanti.ttf)" },
  { name: "联想小新酷黑", value: "lianxiangxiaoxinkuhei", url: "url(style/font/lianxiangxiaoxinkuhei.ttf)" }
])

function loadFont(name, fontUrl) {
  return new Promise(function (resolve, reject) {
    const font = new FontFace(name, fontUrl, {
      "font-display": "auto" // 添加font-display属性
      // 加载优先级
    })
    font.load().then(
      function (loadedFace) {
        document.fonts.add(loadedFace)
        resolve()
      },
      function (error) {
        reject(error)
      }
    )
  })
}

const loadFontsSequentially = () => {
  try {
    for (const fontFile of biFont) {
      loadFont(fontFile.value, fontFile.url)
    }
  } catch (error) {
    console.error("加载字体出错:", error)
  }
}
loadFontsSequentially()
export default biFont
